using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
public class SpringGUIMenuOptions
{
    [MenuItem("GameObject/UI/Buttons/DoubleClickButton" , false , 2065)]
    public static void AddDoubleClickButton(MenuCommand menuCommand )
    {
        // Debug.Log("=========== "+GetStandardResources());

        UnityEngine.UI.DefaultControls.Resources res = new DefaultControls.Resources();
        GameObject dcButton = DefaultControls.CreateButton(res);
        dcButton.name = "DoubleClickButton";
        if(Selection.activeGameObject == null)
        {
            dcButton.transform.SetParent(GameObject.Find("Canvas").transform, false);
        }else
        {
            dcButton.transform.SetParent(Selection.activeGameObject.transform, false);
        }
        dcButton.transform.Find("Text (Legacy)").GetComponent<Text>().text = "双击按钮";
        Object.DestroyImmediate(dcButton.GetComponent<Button>());
        dcButton.AddComponent<DoubleClickButton>();

    }
 
    [MenuItem("GameObject/UI/Buttons/LongClickButton" , false , 2066)]
    public static void AddLongClickButton( MenuCommand menuCommand )
    {
        UnityEngine.UI.DefaultControls.Resources res = new DefaultControls.Resources();
        GameObject dcButton = DefaultControls.CreateButton(res);
        dcButton.name = "LongClickButton";
        if(Selection.activeGameObject == null)
        {
            dcButton.transform.SetParent(GameObject.Find("Canvas").transform, false);
        }else
        {
            dcButton.transform.SetParent(Selection.activeGameObject.transform, false);
        }
        dcButton.transform.Find("Text (Legacy)").GetComponent<Text>().text = "长按按钮";
        Object.DestroyImmediate(dcButton.GetComponent<Button>());
        dcButton.AddComponent<LongClickButton>();
    }


    
}